#ifndef MULTICASTCLIENT_H
#define MULTICASTCLIENT_H

#include <QtWidgets/QMainWindow>
#include "ui_multicastclient.h"
#include <QUdpSocket>
#include <QHostAddress>
#include <QTcpServer>

class MulticastClient : public QMainWindow
{
	Q_OBJECT

public:
	typedef enum {
		eStartRecord,
		eStopRecord
	}CommandType;

public:
	MulticastClient(QWidget *parent = 0);
	~MulticastClient();

	void StartRecord();
	void StopRecord();
	HWND MyFindAxisWindow();

	public slots:
	void processPendingDatagrams();
	void collectData();
	void forwardData();
	void acceptConnection();

	void SendCommand_StartRecord();
	void SendCommand_StopRecord();

private:
	void SendCommand(CommandType cmd);

private:
	Ui::MulticastClientClass ui;

	QUdpSocket*	udpCommandController;

	HWND hMainWnd;
	QUdpSocket *udpSocket;
	QHostAddress groupAddress;

	// Tcp server
	QTcpServer server;
	QTcpSocket* target;
	QVector<QTcpSocket*> collectors;
};

#endif // MULTICASTCLIENT_H
